import os

from langchain.chat_models import init_chat_model

# model = init_chat_model("gpt-4o-mini",
#                         model_provider="openai",
#                         api_key="")


model = init_chat_model("deepseek-chat", model_provider="deepseek"
                       )
#response = model.invoke("你是谁?")
for token in model.stream("你是谁?"):
    print(token.content, end="")



from langchain.schema import (
    AIMessage,  # 等价于OpenAI接口中的assistant role
    HumanMessage,  # 等价于OpenAI接口中的user role
    SystemMessage  # 等价于OpenAI接口中的system role
)

messages = [
    SystemMessage(content="你是积云教育大模型课的课程助理。"),
    HumanMessage(content="我是学员，我叫小积。"),
    AIMessage(content="欢迎！"),
    HumanMessage(content="我是谁？")
]

ret = model.invoke(messages)

print(ret.content)
